package com.whynot.frame.auth.shiro.controller;

import com.whynot.frame.basic.common.model.APIBase;
import com.whynot.frame.basic.common.model.ErrorCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;


/**
 * 描述: shiro的几种权限验证的Rest接口:
 * 作者: chenyao
 * 日期: 2018-01-30.
 * 项目名称: curtain-whynot-shiro-jwt-server
 * 版本: 1.0.0
 * JDK: since 1.8
 */
@Api(value = "shiro",description = "shiro权限接口",hidden = true)
@RestController
public class ShiroController {

    @ApiOperation(value = "未认证的接口", notes = "未授权的接口", response = APIBase.class ,hidden = true)
    @GetMapping(path = "/403")
    public APIBase unauthorized() {
        return new APIBase(ErrorCode.ERR_UN_AUTH, "unauthentication", "未授权",false);
    }

    @ApiOperation(value = "重复登录的接口", notes = "重复登录的接口", response = APIBase.class,hidden = true)
    @GetMapping(path = "/repeatLogin")
    public APIBase repeatLogin() {
        return new APIBase(ErrorCode.ERR_BUS_ERROR, "repeatLogin", "重复登录",false);
    }

    @ApiOperation(value = "未认证的接口", notes = "未认证的接口", response = APIBase.class,hidden = true)
    @GetMapping(path = "/401")
    public APIBase unauthentication () {
        return new APIBase(ErrorCode.ERR_UN_TOKEN, "Unauthorized", "未认证",false);
    }

}